#pragma once

#include "dameon.h"
#include "Sock.h"
#include "ado/DbMysql.h"
#include "snetwork/NluConnection.h"

#define THREAD_MAX 2

extern pthread_mutex_t master_mutex;
extern pthread_mutex_t worker_mutex[THREAD_MAX];
extern pthread_t s_tid[THREAD_MAX];//线程ID
extern unsigned int s_thread_para[THREAD_MAX][2];
extern bool if_sigsegv;

class SNETWORK_API  Sock::CWorkerProcess
{
public:
    static CWorkerProcess *instance();
	CWorkerProcess();
    int CreateWorkProc();
    void WorkerProcessCycle();
    
private:
	std::vector<int> m_pid;
    static CWorkerProcess* m_instance;    
    class CGarbo {public: ~CGarbo(){if (CWorkerProcess::m_instance) delete CWorkerProcess::m_instance;}};
    static CGarbo Garbo;	
};
